package org.example;

import com.sun.tools.attach.AgentInitializationException;
import com.sun.tools.attach.AgentLoadException;
import com.sun.tools.attach.AttachNotSupportedException;
import com.sun.tools.attach.VirtualMachine;

import java.io.IOException;

public class AttacherMain {
    public static void main(String[] args)
            throws AttachNotSupportedException, IOException, AgentLoadException,
                    AgentInitializationException {
        // 传入目标 JVM pid
        VirtualMachine vm = VirtualMachine.attach("78792");
        vm.loadAgent("javaassit-runtime\\target\\javassist-runtime.jar");
        System.out.println("AttacherMain类的main方法执行完毕!");
    }
}
